<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>图片上传、预览、删除</title>
<link rel="stylesheet" href="/tp/css/uploadify.css" />
<script src="/tp/js/jquery17mis.js" type="text/javascript"></script>
<script src="/tp/js/jquery.uploadify.min.js" type="text/javascript"></script>
</head>
<body>
		<p>
        <label>上传图片:</label>
        <input id="file_upload" name="file_upload" type="file" multiple></p>
        
        <p><a href="javascript:$('#file_upload').uploadify('upload')">上传</a>
           <a href="javascript:$('#file_upload').uploadify('cancel','*')">重置上传队列</a>
        </p>
        <!--显示结果--><div id="uploadsuccess" style="display:none;"></div>

<!--上传图片-->
<script type="text/javascript">
var img_id_upload=new Array();//初始化数组，存储已经上传的图片名
var i=0;//初始化数组下标
	$(function() {
		$('#file_upload').uploadify({
			'swf'      : '/tp/img/uploadify.swf',
			'uploader' : '/tp/index.php/Index/uploadimages',
			'auto'     : true,//关闭自动上传
			'buttonText' : '请选择图片',//设置按钮文本片
			'onUploadSuccess' : function(file, data, response) {
				   $('#uploadsuccess').html(data).show();
			}
		});
	});
</script>
<!--删除图片-->
<script>
	$(document).ready(function(){
	$("#uploadsuccess").delegate('a', 'click', function(){
	var value = this.href;
	$.get(value, function(result){
	$("#uploadsuccess").html(result).show();
	});
	return false;
	});
	});
</script>

</body>
</html>
